package com.c1.client.dialog;

import lombok.Getter;

import javax.swing.*;
import java.awt.event.ActionListener;

@Getter
public abstract class BaseButton {
    public abstract String getText();

    public abstract void process();

    public JButton jButton;

    public JButton get(ActionListener actionListener) {
        if (jButton == null) {
            jButton = new JButton(getText());
            jButton.addActionListener(actionListener);
        }
        return jButton;
    }

    public JButton get(ActionListener actionListener, int mnemonic) {
        jButton = get(actionListener);
        jButton.setMnemonic(mnemonic);
        return jButton;
    }
}
